package com.gexin.controller.system.user;

import com.gexin.common.QrCodeKit;
import com.gexin.common.model.ApiResponse;
import com.gexin.common.utils.IdGenerateUtils;
import com.gexin.common.utils.QiNiuUtil;
import com.gexin.core.web.SystemBaseController;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.upload.UploadFile;

/**
 * 权限管理
 * 
 * @author 肖得明 用户资源
 */
@ControllerBind(controllerKey = "/system/demo", viewPath = "WEB-INF/system/admin/")
public class AdminDemoController extends SystemBaseController {

	// 首页 查询所有的 一级菜单
	public void index() {
		render("admin_demo.html");
	}
	
	
	//导入excel 数据
	public void  upload_excel(){
		UploadFile  f =  getFile();
		//System.err.println("JSONFile:" + JsonKit.toJson(f));
		//renderJson(f);
		success();
	}
	
	//演示生成+上传二维码
	public void scQrcode() {
		String file_name= QiNiuUtil.upload(QrCodeKit.getQrCode(getPara("text")), IdGenerateUtils.getId() + ".gif");
		//System.err.println(file_name);
		renderJson(new ApiResponse(file_name));
	}
}
